<template>
  <div class="banner">
    <div class="banner-wrapper" @click="showGallary">
      <img class="banner-img" :src="bannerImg">
      <div class="banner-info">
        <h2 class="banner-title">{{sightName}}</h2>
        <div class="banner-number">
          <span class="iconfont banner-icon">&#xe608;</span>2
        </div>
      </div>
    </div>
    <fade>
      <common-gallary :imgs="gallaryImgs" v-show="gallaryShow" @cloceGallary="cloceGallary" />
    </fade>
  </div>
</template>

<script>
import CommonGallary from 'common/gallary/gallary'
import fade from 'common/fade/fade'
export default {
  name: 'banner',
  props: {
    detailData: Object
  },
  components: {
    CommonGallary,
    fade
  },
  data () {
    return {
      gallaryShow: false
    }
  },
  computed: {
    sightName () {
      return this.detailData.sightName
    },
    bannerImg () {
      return this.detailData.bannerImg
    },
    gallaryImgs () {
      return this.detailData.gallaryImgs
    }
  },
  methods: {
    showGallary () {
      this.gallaryShow = true
    },
    cloceGallary () {
      this.gallaryShow = false
    }
  }
}
</script>

<style lang="stylus" scoped>
  .banner-wrapper
    position relative
    overflow hidden
    height 0
    padding-bottom 55%
    .banner-img
      width 100%
    .banner-info
      display flex
      position absolute
      left 0
      right 0
      bottom 0
      line-height .6rem
      color #fff
      background-image linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, .8))
      .banner-title
        flex 1
        padding 0 .2rem
        font-size .32rem
      .banner-number
        margin-top .14rem
        padding 0 .3rem
        height .32rem
        line-height .32rem
        border-radius .2rem
        font-size .24rem
        background-color rgba(0, 0, 0, .8)
        .banner-icon
          font-size .24rem
          margin-right .08rem
</style>
